#include<bits/stdc++.h>
# define rep(i, j, k) for (int i = j; i <= k; ++i)
# define l(id) tr[id].l
# define r(id) tr[id].r
# define maxl(id) tr[id].maxl
# define minr(id) tr[id].minr
# define ans(id) tr[id].ans
# define inf 100000000
using namespace std;


struct segment
{
	int l, r, maxl, minr, ans;
} tr[2200005];
int q;
multiset < int > all, arr, le[1000005], re[1000005];
void build(int id, int l, int r)
{
	l(id) = l, r(id) = r, maxl(id) = -inf, minr(id) = ans(id) = inf; if (l == r) return;
	int mid = (l + r) / 2; build(2 * id, l, mid), build(2 * id + 1, mid + 1, r);
}
void merge(int id){maxl(id) = max(maxl(2 * id), maxl(2 * id + 1)), minr(id) = min(minr(2 * id), minr(2 * id + 1));
	ans(id) = min(min(ans(2 * id), ans(2 * id + 1)), minr(2 * id + 1) - maxl(2 * id) + 1);}
void upd(int id, int p, int dir)
{
	if (l(id) == r(id))
	{
		if (dir) {if (le[l(id)].empty()) minr(id) = inf; else minr(id) = *le[l(id)].begin();}
		else if (re[l(id)].empty()) maxl(id) = -inf; else maxl(id) = *re[l(id)].rbegin();
		return;
	}
	upd(2 * id + (p > r(2 * id)), p, dir); merge(id);
}
signed main()
{
	freopen("stone.in", "r", stdin);
	freopen("stone.out", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
	build(1, 1, 1000000);
	cin >> q;
	while (q--)
	{
		char c; int l, r; cin >> c >> l >> r; --r;
		if (c == 'A')
		{
			all.insert(l), arr.insert(r);
			le[l].insert(r), re[r].insert(l);
			upd(1, l, 1), upd(1, r, 0);
		}
		else
		{
			all.erase(all.find(l)), arr.erase(arr.find(r));
			le[l].erase(le[l].find(r)), re[r].erase(re[r].find(l));
			upd(1, l, 1), upd(1, r, 0);
		}
		if (ans(1) <= 1000000) cout << ans(1) << '\n';
		else
		{
			int maxl = *all.rbegin(), minr = *arr.begin();
			cout << *le[maxl].begin() - *re[minr].rbegin() + 1 << '\n';
		}
	}
	return 0;
}